<?php
  $uri_segment = $this->uri->segment(3);
  if($uri_segment != "" && $uri_segment != "all"){
      $option = parsing_param2($uri_segment);
      $awal = datefmysql($option['awal']);
      $akhir = datefmysql($option['akhir']);
      $adik_asuh = $option['adikAsuh'];
      $id_adik_asuh = $option['idAdikAsuh'];
  }else{
      $awal = date('d/m/Y');
      $akhir = date('d/m/Y');
      $adik_asuh = '';
      $id_adik_asuh = '';
  }
?>
<html>
    <head>
        <title>Cetak Laporan Keuangan Adik Asuh</title>
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/style2.css" />
        <link rel="stylesheet" type="text/css" href="<?php echo base_url();?>system/css/tabel.css" />
        <script type="text/javascript">
                function cetak() {
                        SCETAK.innerHTML = '';
                        window.print();
                        if (confirm('Apakah menu print ini akan ditutup?')) {
                                window.close();
                        }
                        SCETAK.innerHTML = '<br /><input onClick=\'cetak()\' type=\'submit\' name=\'Submit\' value=\'Cetak\' class=\'tombol\'>';
                }

        </script>
    </head>
    <body>
        <center>
            <h1>Laporan Keuangan Adik Asuh</h1>
            <h2>Periode <?php echo indo_tgl($awal)?> s.d <?php echo indo_tgl($akhir)?></h2>
            <?php
              if($adik_asuh != ''){
            ?>
            <h2>Nama Adik Asuh : <?php echo "$adik_asuh";?></h2>
            <?php
              }
            ?>
        </center>
        <div class="data-list">
                <table class="tabel" style="width: 100%">
                <tr>
                    <th style="width:3%">No</th>
                    <th style="width:5%">Tanggal</th>
                    <th style="width:10%">Petugas</th>
                    <th style="width:10%">Adik Asuh</th>
                    <th>Sekolah</th>
                    <th style="width:5%">Kelas</th>
                    <th style="width:8%">Tahun Ajaran</th>
                    <th>Keterangan</th>
                    <th style="width:8%">Debet (Rp.)</th>
                    <th style="width:8%">Kredit (Rp.)</th>
                    <th style="width:8%">Saldo (Rp.)</th>
                </tr>
                <?php
                  $no = 1;
                  foreach ($listKeuanganAdikAsuh as $row){
                ?>
                <tr class="<?php echo ($no%2)?"even":"odd"?>">
                    <td align="center"><?php echo $no++;?></td>
                    <td><?php echo datefmysql($row['tanggal']);?></td>
                    <td><?php echo $row['petugas'];?></td>
                    <td><?php echo $row['adik_asuh'];?></td>
                    <td><?php echo $row['sekolah'];?></td>
                    <td><?php echo $row['kelas'];?></td>
                    <td><?php echo $row['tahun_ajaran']." ".$row['semester'];?></td>
                    <td><?php echo $row['keterangan'];?></td>
                    <td style="text-align: right">
                       <?php 
                          echo ($row['debet']!=0)?rupiah($row['debet']):"-";
                       ?>
                    </td>
                    <td style="text-align: right">
                       <?php 
                          echo ($row['kredit']!=0)?rupiah($row['kredit']):"-";
                       ?>
                    </td>
                    <td align="right"><?php echo rupiah($row['saldo']);?></td>
                </tr>
                <?php
                  }
                ?>
            </table>
        </div>
        <center><span id="SCETAK"><input type="button" class="tombol" value="Cetak" onClick="cetak()"/></span></center>
    </body>
</html>    
